****************************************************************************************************
use "/Users/daniellethomsen/Dropbox/State Legislator Project 2/Paper/Perspectives/R&R/Replication/Data.dta", clear

*table 1, columns 1 and 2
reg reply2 gender2 rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyinfo gender2 rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*table 1, columns 3 and 4
reg reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority c.votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

****************************************************************************************************
*table 2, columns 1 and 2 (A&B)
reg reply2 i.gender2##c.mrp_mean nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
reg replyinfo i.gender2##c.mrp_mean nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust

*figure 1a
reg reply2 i.gender2##c.mrp_mean nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
margins, atmeans at(mrp_mean=(-.7(.1).5) gender2=(0 1) rep=1 chamber=0 pleader=0 commchair2=0 minority=0)
marginsplot, xlabel(-.6(.2).4, labsize(small)) yline(0) scheme(s1manual) ///
 recast(line) recastci(rarea) ylabel(0.4(.1)0.8) ytitle("Probability of Responding", size(medsmall)) ///
 xtitle("District Conservatism", size(med)) title(" ", size(large)) ///
 legend(order(1 2) label(1 "Male Legislators") label(2 "Female Legislators"))

*figure 1b
reg replyinfo i.gender2##c.mrp_mean nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
margins, atmeans at(mrp_mean=(-.7(.1).5) gender2=(0 1) rep=1 chamber=0 pleader=0 commchair2=0 minority=0)
marginsplot, xlabel(-.6(.2).4, labsize(small)) yline(0) scheme(s1manual) ///
 recast(line) recastci(rarea) ylabel(0.2(.1)0.5) ytitle("Probability of Responding Helpfully", size(medsmall)) ///
 xtitle("District Conservatism", size(med)) title(" ", size(large)) ///
 legend(order(1 2) label(1 "Male Legislators") label(2 "Female Legislators"))

*table 2, columns 3 and 4 (P&Y)
reg reply2 i.gender2##c.wfd_scale nl_totalbills rep chamber2  pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
reg replyinfo i.gender2##c.wfd_scale nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust

*table 2, columns 5 and 6 (P&D)
reg reply2 i.gender2##c.femchamber nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust
reg replyinfo i.gender2##c.femchamber nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust

*table 2, columns 7 and 8 (female committee chairs)
reg reply2 i.gender2##c.ratiofemcommchair2 nl_totalbills rep chamber2 pleader yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust
reg replyinfo i.gender2##c.ratiofemcommchair2 nl_totalbills rep chamber2 pleader yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust

****************************************************************************************************
*table 3, columns 1 and 2 (in legislatures with no staff)
reg reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2 if nostaff==1, robust
reg replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2 if nostaff==1, robust

*table 3, columns 3 and 4 (excluding staff replies)
reg replyleg2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyleg2info gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*table 3, columns 5 and 6 (ideology)
reg reply2 gender2 cfscore2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyinfo gender2 cfscore2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

****************************************************************************************************
*table 4, columns 1 and 2 (leg gender x constituent gender)
reg reply2 i.gender2##i.gendersender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyinfo i.gender2##i.gendersender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*table 4, columns 3 and 4 (leg gender x gender treatment)
reg reply2 i.gender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyinfo i.gender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*table 4, columns 5 and 6 (constituent gender x gender treatment)
reg reply2 i.gender2 i.gendersender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyinfo i.gender2 i.gendersender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

****************************************************************************************************
****************************************************************************************************
*appendix
*************************with kimberly and robert aliases (appendix a)
*appendix a, columns 1 and 2
reg reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 kimberly i.state2, robust
reg replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 kimberly i.state2, robust

*appendix a, columns 3 and 4
reg reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 michael i.state2, robust
reg replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 michael i.state2, robust

*************************helpful reply only among legislators who reply (appendix c)
reg replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2 if reply2==1, robust
reg replyleg2info gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2 if reply2==1, robust

*************************totalbills (appendix d)
reg nl_totalbills gender2 i.state2, robust
reg nl_totalbills gender2 rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*************************multi-level models (appendix f)
mixed reply2 i.gender2 rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 || state2: || districtid: 
mixed replyinfo i.gender2 rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 || state2: || districtid: 

mixed reply2 i.gender2 c.nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 || state2: || districtid: 
mixed replyinfo i.gender2 c.nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 || state2: || districtid: 

*************************bivariate models (appendix g)
*with state FE (columns 1 to 4)
reg reply2 gender2 i.state2 if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust
reg replyinfo gender2 i.state2 if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust
reg reply2 gender2 nl_totalbills i.state2 if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust
reg replyinfo gender2 nl_totalbills i.state2 if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust

*no state FE (columns 1 to 4)
reg reply2 gender2 if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust
reg replyinfo gender2 if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust
reg reply2 gender2 nl_totalbills if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust
reg replyinfo gender2 nl_totalbills if rep!=. & chamber2!=. & pleader!=. & commchair2!=. & yrserved2!=. & minority!=. & votepct3!=. & reelection!=. & mrp_mean!=. & totpop2!=. & incomex2!=. & state2!=., robust

*************************with interaction between gender and bills sponsored (appendix i)
reg reply2 i.gender2##c.nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
reg replyinfo i.gender2##c.nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*************************leg hires staff, staff leg ratio (appendix j)
*controlling for staff leg ratio, columns 1 and 2
reg reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 stafflegratio i.state2, robust
reg replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 stafflegratio i.state2, robust

*controlling for whether leg hires staff, columns 3 and 4
reg reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 leghire i.state2, robust
reg replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 leghire i.state2, robust

*************************logistic regressions (appendix l) 
*table 1
logit reply2 gender2 rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit replyinfo gender2 rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*table 2
logit reply2 i.gender2##c.mrp_mean nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
logit replyinfo i.gender2##c.mrp_mean nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
logit reply2 i.gender2##c.wfd_scale nl_totalbills rep chamber2  pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
logit replyinfo i.gender2##c.wfd_scale nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection totpop2 incomex2 i.state2, robust
logit reply2 i.gender2##c.femchamber nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust
logit replyinfo i.gender2##c.femchamber nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust
logit reply2 i.gender2##c.ratiofemcommchair2 nl_totalbills rep chamber2 pleader yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust
logit replyinfo i.gender2##c.ratiofemcommchair2 nl_totalbills rep chamber2 pleader yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2, robust

*table 3
*in legislatures with no staff
logit reply2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2 if nostaff==1, robust
logit replyinfo gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2 if nostaff==1, robust

*excluding staff replies
logit replyleg2 gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit replyleg2info gender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*ideology
logit reply2 gender2 cfscore2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit replyinfo gender2 cfscore2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*table 4, 
*columns 1 and 2 (leg gender x constituent gender)
logit reply2 i.gender2##i.gendersender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit replyinfo i.gender2##i.gendersender2 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*columns 3 and 4 (leg gender x gender treatment)
logit reply2 i.gender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit replyinfo i.gender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

*columns 5 and 6 (constituent gender x gender treatment)
logit reply2 i.gender2 i.gendersender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust
logit replyinfo i.gender2 i.gendersender2##i.gtreatment3 nl_totalbills rep chamber2 pleader commchair2 yrserved2 minority votepct3 reelection mrp_mean totpop2 incomex2 i.state2, robust

****************************MMDs (appendix h)
use "/Users/daniellethomsen/Dropbox/State Legislator Project 2/Paper/Perspectives/R&R/Replication/Data_MMDs.dta", clear

*MMDs models (columns 1 to 4)
reg reply2 gender2 i.stdistchambgroup, robust
reg replyinfo gender2 i.stdistchambgroup, robust

reg reply2 gender2 nl_totalbills rep pleader commchair2 yrserved2 minority votepct3 i.stdistchambgroup, robust
reg replyinfo gender2 nl_totalbills rep pleader commchair2 yrserved2 minority votepct3 i.stdistchambgroup, robust
